home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / controls / edactive.frm < prev    next >
Text File  |  1993-05-16  |  3KB  |  110 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Using Screen.ActiveControl"
  4.    ClientHeight    =   4020
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1770
  7.    ClientWidth     =   7365
  8.    Height          =   4710
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4020
  12.    ScaleWidth      =   7365
  13.    Top             =   1140
  14.    Width           =   7485
  15.    Begin TextBox txtBuffer 
  16.       Height          =   2295
  17.       Left            =   4680
  18.       MultiLine       =   -1  'True
  19.       ScrollBars      =   3  'Both
  20.       TabIndex        =   1
  21.       Top             =   960
  22.       Width           =   2295
  23.    End
  24.    Begin TextBox txtEditBox 
  25.       Height          =   2295
  26.       Left            =   480
  27.       MultiLine       =   -1  'True
  28.       ScrollBars      =   3  'Both
  29.       TabIndex        =   0
  30.       Top             =   960
  31.       Width           =   2295
  32.    End
  33.    Begin Label Label2 
  34.       Caption         =   "Paste Buffer"
  35.       Height          =   255
  36.       Left            =   4680
  37.       TabIndex        =   3
  38.       Top             =   720
  39.       Width           =   1215
  40.    End
  41.    Begin Label Label1 
  42.       Caption         =   "Editing Box"
  43.       Height          =   255
  44.       Left            =   480
  45.       TabIndex        =   2
  46.       Top             =   720
  47.       Width           =   1215
  48.    End
  49.    Begin Menu mnuFile 
  50.       Caption         =   "&File"
  51.       Begin Menu mnuFileExit 
  52.          Caption         =   "E&xit"
  53.       End
  54.    End
  55.    Begin Menu mnuEdit 
  56.       Caption         =   "&Edit"
  57.       Begin Menu mnuEditCut 
  58.          Caption         =   "Cu&t"
  59.          Shortcut        =   ^X
  60.       End
  61.       Begin Menu mnuEditCopy 
  62.          Caption         =   "&Copy"
  63.          Shortcut        =   ^C
  64.       End
  65.       Begin Menu mnuEditPaste 
  66.          Caption         =   "&Paste"
  67.          Shortcut        =   ^V
  68.       End
  69.    End
  70. End
  71. Option Explicit
  72.  
  73. Dim msg1 As String
  74. Dim msg2 As String
  75.  
  76. Sub Form_Load ()
  77.     msg1 = "The Editing box must be the active control!"
  78.     msg2 = "Do you know where the focus is?"
  79. End Sub
  80.  
  81. Sub mnuEditCopy_Click ()
  82.     If screen.ActiveControl Is txtEditBox Then
  83.         txtBuffer.Text = txtEditBox.SelText
  84.     Else
  85.         MsgBox msg1, 0, msg2
  86.     End If
  87. End Sub
  88.  
  89. Sub mnuEditCut_Click ()
  90.     If screen.ActiveControl Is txtEditBox Then
  91.         txtBuffer.Text = txtEditBox.SelText
  92.         txtEditBox.SelText = ""
  93.     Else
  94.         MsgBox msg1, 0, msg2
  95.     End If
  96. End Sub
  97.  
  98. Sub mnuEditPaste_Click ()
  99.     If screen.ActiveControl Is txtEditBox Then
  100.          txtEditBox.SelText = txtBuffer.Text
  101.     Else
  102.         MsgBox msg1, 0, msg2
  103.     End If
  104. End Sub
  105.  
  106. Sub mnuFileExit_Click ()
  107.     End
  108. End Sub
  109.  
  110.